#include<bits/stdc++.h>
#define int long long
using namespace std;
const int Maxn = 50;
int T, n;
int a[Maxn], b[Maxn];
char s[Maxn], ans[Maxn];
struct node{
	string s;
	int id;
};

void dfs(int x){
	for(int i = 1 ; i < 2 * (x - 1) ; i++){
		int j = (i + 1) / 2;
		if((i & 1) && j + b[i] / 2 >= x) continue;
		if(!(i & 1) && j + b[i] / 2 >= x) continue;
		if((i & 1) == 0){
			int l = j - 1, r = j, sum = 0;
			while(l >= 1 && r < x && s[l] == s[r]){
				sum += 2;
				l--, r++;
			}
			if(sum != b[i]) return ;
		}
		else{
			int l = j - 1, r = j + 1, sum = 1;
			while(l >= 1 && r < x && s[l] == s[r]){
				sum += 2;
				l--, r++;
			}
			if(sum != b[i]) return ;
		}
	}
	if(x > n){
		
		return ;
	}
	for(int i = 0 ; i < 26 ; i++){
		s[x] = 'a' + i;
		dfs(x + 1);
	}
}
signed main(){
	ios::sync_with_stdio(false);
	freopen("string.in", "r", stdin);
	freopen("string.out", "w", stdout);
	cin >> T;
	while(T--){
		cin >> n;
		for(int i = 1 ; i <= n ; i++) cin >> a[i];
		for(int i = 1 ; i < 2 * n ; i++) cin >> b[i];
		cout << -1 << '\n';
//		dfs(1);
	}
	return 0;
}
/*
4 6 5 3 2 0 1 7
1 0 3 0 1 0 1 0 1 0 1 0 1 0 1

*/
